{% extends '::base.html.twig' %} 
{% block title %}Usuarios :: Editar{% endblock %}

{% block module_name %}Usuarios{% endblock %}

{% block body %}
<h2>Formulario</h2>
<div class="widget_inside records_list">
    {% if entity.rolesUsuario != "ROLE_SUPER_ADMIN" %}
    <div class="form">
        <form action="{{ path('usuarios_update', { 'id': entity.id }) }}" method="post" {{ form_enctype(edit_form) }} id="formID">
            {{ form_widget(edit_form) }}
            <div class="clearfix">
                <label>Contrase&ntilde;a</label>
                <div class="input">
                    <input type="password" name="password" value="" required />
                </div>
            </div>
            <div class="clearfix">
                <label>Role</label>
                <div class="input">
                    <select name="role">
                        <option {% if entity.rolesUsuario == "ROLE_USER" %} selected {% endif %} value="ROLE_USER">Usuario Normal</option>
                        <option {% if entity.rolesUsuario == "ROLE_ADMIN" %} selected {% endif %} value="ROLE_ADMIN">Usuario Administrador</option>
                    </select>
                </div>
            </div>
            <div class="clearfix grey-highlight"> 
                <div class="input no-label">
                    <button type="submit" class="button blue">Guardar</button>
                </div>
            </div>
        </form>
    </div>
    {% endif %}
    {% if entity.rolesUsuario == "ROLE_SUPER_ADMIN" %}
    <span class="notification undone">No se puede editar este usuario</span>
    {% endif %}
    <div class="margin_top_15 right">
        {% if entity.rolesUsuario != "ROLE_SUPER_ADMIN" %}
        <form action="{{ path('usuarios_delete', { 'id': entity.id }) }}" method="post" style="display: inline-block;">
            {{ form_widget(delete_form) }}
            <button type="submit" class="button black">Eliminar</button>
        </form>
        {% endif %}
        <a href="{{ path('usuarios') }}" class="button">Regresar a la Lista</a>
    </div>
</div>
{% endblock %}